package com.fimuz.mqmeet.api.role.control;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.fimuz.mqmeet.api.role.service.RoleService;
import com.fimuz.mqmeet.api.role.service.model.GetSpModel;
import com.fimuz.mqmeet.api.role.service.model.GetSrModel;
import com.fimuz.mqmeet.api.role.service.model.ListSpModel;
import com.fimuz.mqmeet.api.role.service.model.ListSrModel;
import com.fosun.spr.core.base.CoBaseControl;
import com.fosun.spr.core.utils.SessionUtils;

@Controller
public class RoleControl extends CoBaseControl {
	//@Autowired
	@Resource
	private RoleService roleService;

	/**
	 * http://127.0.0.1:8080/mq_meet_server/api/role/list
	 * 
	 * @param request
	 * @param spModel
	 * @return
	 */	
	@RequestMapping(value = "/api/role/list",method = RequestMethod.GET)
	public ListSrModel list(HttpServletRequest request, ListSpModel spModel) {
		SessionUtils.fillSpModel(request, spModel);
		ListSrModel srModel = roleService.list(spModel);
		return srModel;
	}
	/**
	 * http://127.0.0.1:8080/mq_meet_server/api/role/get
	 * 
	 * @param request
	 * @param spModel
	 * @return
	 */	
	@RequestMapping(value = "/api/role/get",method = RequestMethod.GET)
	public GetSrModel get(HttpServletRequest request, GetSpModel spModel) {
		SessionUtils.fillSpModel(request, spModel);
		GetSrModel srModel = roleService.get(spModel);
		return srModel;
	}
	
	
	//生成成json的代码
	public static void main(String[] args) throws Exception{
	}	
}
